class UdtTbDocmentstock {
  String? id;
  String? documentno;
  String? documentname;
  String? documenttypeId;
  String? documenttypeName;
  String? fileName;
  String? departmentId;
  String? departmentName;
  String? status;
  String? areaId;
  String? areaName;
  String? locationId;
  String? locationName;
  String? remark;
  String? createUid;
  String? createName;
  String? createDate;
  String? writeUid;
  String? writeDate;
  String? station;

  UdtTbDocmentstock({
    this.id,
    this.documentno,
    this.documentname,
    this.documenttypeId,
    this.documenttypeName,
    this.fileName,
    this.departmentId,
    this.departmentName,
    this.status,
    this.areaId,
    this.areaName,
    this.locationId,
    this.locationName,
    this.remark,
    this.createUid,
    this.createName,
    this.createDate,
    this.writeUid,
    this.writeDate,
    this.station,
  });

  UdtTbDocmentstock copyWith({
    String? id,
    String? documentno,
    String? documentname,
    String? documenttypeId,
    String? documenttypeName,
    String? departmentId,
    String? departmentName,
    String? status,
    String? areaId,
    String? areaName,
    String? locationId,
    String? locationName,
    String? remark,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
  }) {
    return new UdtTbDocmentstock(
      id: id ?? this.id,
      documentno: documentno ?? this.documentno,
      documentname: documentname ?? this.documentname,
      documenttypeId: documenttypeId ?? this.documenttypeId,
      documenttypeName: documenttypeName ?? this.documenttypeName,
      departmentId: departmentId ?? this.departmentId,
      departmentName: departmentName ?? this.departmentName,
      status: status ?? this.status,
      areaId: areaId ?? this.areaId,
      areaName: areaName ?? this.areaName,
      locationId: locationId ?? this.locationId,
      locationName: locationName ?? this.locationName,
      remark: remark ?? this.remark,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
    );
  }

  @override
  String toString() {
    return '''UdtTbDocmentstock{
      id: $id,
      documentno: $documentno,
      documentname: $documentname,
      documenttypeId: $documenttypeId,
      documenttypeName: $documenttypeName,
      status: $status,
      areaId: $areaId,
      areaName: $areaName,
      locationId: $locationId,
      locationName: $locationName,
      remark: $remark,
      createUid: $createUid,
      createDate: $createDate,
      writeUid: $writeUid,
      writeDate: $writeDate,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is UdtTbDocmentstock &&
          runtimeType == other.runtimeType &&
          id == other.id &&
          documentno == other.documentno &&
          documentname == other.documentname &&
          documenttypeId == other.documenttypeId &&
          documenttypeName == other.documenttypeName &&
          status == other.status &&
          areaId == other.areaId &&
          areaName == other.areaName &&
          locationId == other.locationId &&
          locationName == other.locationName &&
          remark == other.remark &&
          createUid == other.createUid &&
          createDate == other.createDate &&
          writeUid == other.writeUid &&
          writeDate == other.writeDate);

  factory UdtTbDocmentstock.fromMap(Map<String, dynamic> map) {
    return new UdtTbDocmentstock(
      id: map['id'].toString() as String?,
      documentno: map['documentno'].toString() as String?,
      documentname: map['documentname'].toString() as String?,
      documenttypeId: map['documenttype_id'][0].toString() as String?,
      documenttypeName: map['documenttype_id'][1].toString() as String?,
      departmentId: map['department_id'][0].toString() as String?,
      departmentName: map['department_id'][1].toString() as String?,
      status: map['status'].toString() as String?,
      areaId: map['area_id'][0].toString() as String?,
      areaName: map['area_id'][1].toString() as String?,
      locationId: map['location_id'][0].toString() as String?,
      locationName: map['location_id'][1].toString() as String?,
      remark:
          (map['remark'] != false) ? map['remark'].toString() as String? : "",
      createUid: map['create_uid'].toString() as String?,
      createName: map['create_uid'] != false
          ? map['create_uid'][1].toString() as String?
          : '',
      createDate: map['create_date'].toString() as String?,
      writeUid: map['write_uid'].toString() as String?,
      writeDate: map['write_date'].toString() as String?,
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'documentno': this.documentno,
      'documentname': this.documentname,
      'documenttypeId': this.documenttypeId,
      'documenttypeName': this.documenttypeName,
      'departmentId': this.departmentId,
      'departmentName': this.departmentName,
      'status': this.status,
      'areaId': this.areaId,
      'areaName': this.areaName,
      'locationId': this.locationId,
      'locationName': this.locationName,
      'remark': this.remark,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.id != null && this.id != '') ['id', '=', this.id as int],
      if (this.documentno != null && this.documentno != '')
        ['documentno', '=', '${this.documentno}'],
      if (this.documentname != null && this.documentname != '')
        ['documentname', 'like', '%${this.documentname}%'],
      if (this.fileName != null && this.fileName != '')
        ['name&', 'like', '%${this.fileName}%'],
      if (this.documenttypeId != null && this.documenttypeId != '')
        ['documenttype_id', '=', int.parse(this.documenttypeId!)],
      if (this.departmentId != null && this.departmentId != '')
        ['department_id', '=', int.parse(this.departmentId!)],
      if (this.status != null && this.status != '')
        ['status', '=', this.status],
      if (this.areaId != null && this.areaId != '')
        ['area_id', '=', int.parse(this.areaId!)],
      if (this.locationId != null && this.locationId != '')
        ['location_id', '=', int.parse(this.locationId!)],
      if (this.remark != null && this.remark != '')
        ['remark', 'like', '%${this.remark}%'],
      if (this.createUid != null && this.createUid != '')
        ['create_uid', '=', this.createUid],
      if (this.createDate != null && this.createDate != '')
        ['create_date', '=', this.createDate],
      if (this.writeUid != null && this.writeUid != '')
        ['write_uid', '=', this.writeUid],
      if (this.writeDate != null && this.writeDate != '')
        ['write_date', '=', this.writeDate],
      if (this.station != null && this.station != '')
        ['station', '=', int.parse(this.station!)],
    ] as List;
    if (list.length == 0) {
      list.add(['id', '!=', null]);
    }
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'documentno': this.documentno,
      'documentname': this.documentname,
      'documenttype_id': this.documenttypeId,
      'department_id': this.departmentId,
      'status': this.status,
      'area_id': this.areaId,
      'location_id': this.locationId,
      'remark': this.remark,
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
